import {http} from '@zkwq/business'
import axios from 'axios'


axios.interceptors.response.use(
  (response) => {
    if(response.data && response.data.code == -403){
      window.location.href = '/disabled'
    }
    return response
  },
  (error) => {
    if (error.response.status === 403) {
      location.href = '/disabled'
    }
    return Promise.reject(error)
  }
)


export const LoginPlatform = (user) => http.post('/yundianApi/user/login',user)
export const OutLoginPlatform = () => http.get('/yundianApi/user/outLogin')

export const UpdateUser = (user) => http.post('/yundianApi/user/updateUser',user)
export const SendCodeEmail = (target) => http.get('/yundianApi/user/sendCode/email',{target})
export const SendCodeMobile = (target) => http.get('/yundianApi/user/sendCode/mobile',{target})
export const VerifyCode = (email,code) => http.get('/yundianApi/user/verifyCode',{email,code})
